<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2019/11/5
  Time: 23:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生选课系统</title>
    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        *{
            margin:0;
            padding:0;
        }
        .div{
            margin-top:30px;
            width:100%;
            font-size:20px;
            text-align:center;
        }
        .title{
            width: 100%;
            height: 50px;
            line-height: 80px;
            text-align: center;
            font-size: 30px;
            font-family: kaiti;
        }
    </style>
</head>
<body>
<div style="width:900px;height: 700px; margin: 0 auto">
    <div class="title">
        <b>本学期选课结果</b>
    </div>
    <div>
        <div class="div">
            <table class="table table-striped">
                <thead style="background-color: #87CEFA;opacity: 0.9">
                <tr>
                    <th>课程号</th>
                    <th>课程名</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>课程属性</th>
                    <th>学时</th>
                    <th>学分</th>
                    <th>老师</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="data" items="${listReady}" >
                    <tr>
                        <td hidden >${data.id}</td>
                        <td id="no">${data.course_no}</td>
                        <td id="name">${data.course_name}</td>
                        <td>${data.course_start}</td>
                        <td>${data.course_end}</td>
                        <td>${data.course_attribute}</td>
                        <td>${data.course_hour}</td>
                        <td>${data.course_socer}</td>
                        <td>${data.tea_name}</td>
                        <td hidden id="tea_account">${data.tea_account}</td>
                        <td><button class="btn btn-danger" onclick="toDelete(this)">退课</button></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
<script>
    function toDelete(e){
        var no = $(e).parent().parent().children("#no").text();
        var name = $(e).parent().parent().children("#name").text();
        var tea_account = $(e).parent().parent().children("#tea_account").text();
        var fan = window.confirm("确定要删除"+name+"课吗?");
        if(fan){
            window.location.href="deleteCourse?planCourse_id="+no+"&tea_account="+tea_account;
        }
    }
</script>
</html>

